home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / GLUT-3.7 / LIB / GLE / TUBE_GC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-12  |  2.4 KB  |  75 lines

  1.  
  2. /*
  3.  * tube_gc.h
  4.  *
  5.  * FUNCTION:
  6.  * This file allows for easy changes to changes in the way the extrusion
  7.  * library handles state info (i.e. context).
  8.  *
  9.  * HISTORY:
  10.  * Linas Vepstas --- February 1993
  11.  * Added auto texture coord generation hacks, Linas April 1994
  12.  */
  13.  
  14. typedef float gleColor[3];
  15. typedef double gleTwoVec[2];
  16.  
  17. typedef struct {
  18.  
  19.    /* public methods */
  20.    void (*bgn_gen_texture) (int, double);
  21.    void (*n3f_gen_texture) (float *);
  22.    void (*n3d_gen_texture) (double *);
  23.    void (*v3f_gen_texture) (float *, int, int);
  24.    void (*v3d_gen_texture) (double *, int, int);
  25.    void (*end_gen_texture) (void);
  26.  
  27.    /* protected members -- "general knowledge" stuff */
  28.    int join_style;
  29.  
  30.    /* arguments passed into extrusion code */ 
  31.    int ncp;     /* number of contour points */
  32.    gleTwoVec *contour;    /* 2D contour */
  33.    gleTwoVec *cont_normal;  /* 2D contour normals */
  34.    gleDouble *up;               /* up vector */
  35.    int npoints;  /* number of points in polyline */
  36.    gleVector *point_array;     /* path */
  37.    gleColor *color_array;         /* path colors */
  38.    gleAffine *xform_array;  /* contour xforms */
  39.  
  40.    /* private members, used by texturing code */
  41.    int num_vert;
  42.    int segment_number;
  43.    double segment_length;
  44.    double accum_seg_len;
  45.    double prev_x;
  46.    double prev_y;
  47.  
  48.    void (*save_bgn_gen_texture) (int, double);
  49.    void (*save_n3f_gen_texture) (float *);
  50.    void (*save_n3d_gen_texture) (double *);
  51.    void (*save_v3f_gen_texture) (float *, int, int);
  52.    void (*save_v3d_gen_texture) (double *, int, int);
  53.    void (*save_end_gen_texture) (void);
  54.  
  55. } gleGC;
  56.  
  57. extern gleGC *_gle_gc;
  58. extern gleGC * gleCreateGC (void);
  59.  
  60. #define INIT_GC() {if (!_gle_gc) _gle_gc = gleCreateGC(); }
  61. #define extrusion_join_style (_gle_gc->join_style)
  62.  
  63. #define __TUBE_CLOSE_CONTOUR (extrusion_join_style & TUBE_CONTOUR_CLOSED)
  64. #define __TUBE_DRAW_CAP (extrusion_join_style & TUBE_JN_CAP)
  65. #define __TUBE_DRAW_FACET_NORMALS (extrusion_join_style & TUBE_NORM_FACET)
  66. #define __TUBE_DRAW_PATH_EDGE_NORMALS (extrusion_join_style & TUBE_NORM_PATH_EDGE)
  67.  
  68. #define __TUBE_STYLE (extrusion_join_style & TUBE_JN_MASK)
  69. #define __TUBE_RAW_JOIN (extrusion_join_style & TUBE_JN_RAW)
  70. #define __TUBE_CUT_JOIN (extrusion_join_style & TUBE_JN_CUT)
  71. #define __TUBE_ANGLE_JOIN (extrusion_join_style & TUBE_JN_ANGLE)
  72. #define __TUBE_ROUND_JOIN (extrusion_join_style & TUBE_JN_ROUND)
  73.  
  74. /* ======================= END OF FILE ========================== */
  75.